/**
 * $Id: ApplicationUnitTest.java 56 2010-01-23 14:49:04Z aaron.day $
 */
package org.crazydays.gameplan;


import org.junit.*;
import static org.junit.Assert.*;

/**
 * ApplicationUnitTest
 */
public class ApplicationUnitTest
{
    /**
     * Test initializeLocation().
     */
    @Test
    public void testInitializeLocation()
    {
        // objects
        Preferences preferences = new Preferences();
        int x = 42;
        int y = 24;

        // setup
        preferences.setProperty(Application.APPLICATION_X, x);
        preferences.setProperty(Application.APPLICATION_Y, y);

        Application application = new Application();
        application.preferences = preferences;

        // test
        application.initializeLocation();

        // verify
        assertEquals("x", x, (int) application.getLocation().getX());
        assertEquals("y", y, (int) application.getLocation().getY());
    }

    /**
     * Test initializePreferredSize().
     */
    @Test
    public void testInitializePreferredSize()
    {
        // objects
        Preferences preferences = new Preferences();
        int width = 42;
        int height = 24;

        // setup
        preferences.setProperty(Application.APPLICATION_WIDTH, width);
        preferences.setProperty(Application.APPLICATION_HEIGHT, height);

        Application application = new Application();
        application.preferences = preferences;

        // test
        application.initializePreferredSize();

        // verify
        assertEquals("width", width, (int) application.getPreferredSize()
            .getWidth());
        assertEquals("height", height, (int) application.getPreferredSize()
            .getHeight());
    }
}
